﻿<!--#include file="h.asp"--><%
'
'	七色虎建站系统
'	论坛跳转页面(已废弃,新论坛页面bbs_topics.asp)
'	2011.11.2

Sub main
	'论坛列表配置
	If Not ifNum(numBbsList) Then numBbsList="10"'论坛列表数

	Dim rs,sql,id,act,tpl,body_
	Dim classname,userid,theme,ad4txt,post,list
	Dim tid,title,reply,name,hit,pid,type_
	Dim pagesize,count,page,pagecount,i
	Dim imgJing,imgDing,imgFile,ImgImage
	Dim tip_'控制置顶和精铁标志
	id=getN("id",1)
	act=LCase(getData("act"))
	tpl=ubbcode(tplTopic)
	body_ = ""
	Set rs=hu.conn("select name,remark,host from 74hu_bbs where classid="&id)
	If Not rs.eof Then
		Dim ex_
		If act="new" Then
			ex_ = "新帖."&hu.url("bbs_topic.asp?id="&id,"顶帖")&"."
		Else
			ex_ = hu.url("bbs_topic.asp?id="&id&"&amp;act=new","新帖")&".顶帖."
		End If
		Select Case act
			Case ""
				ex_ = hu.url("bbs_topic.asp?id="&id&"&amp;act=new","新帖")&".顶帖."&hu.url("bbs_topic.asp?id="&id&"&amp;act=good","精华")
				sql = "select t.id,t.title,t.reply,t.hit,t.pid,t.type,u.name from 74hu_topic t inner join 74hu_user u on t.userid=u.id where t.classid="&id&" order by t.pid desc,t.livetime desc"
			Case "new"
				ex_ = "新帖."&hu.url("bbs_topic.asp?id="&id, "顶帖")&"."& hu.url("bbs_topic.asp?id="&id&"&amp;act=good","精华")
				sql = "select t.id,t.title,t.reply,t.hit,t.type,u.name from 74hu_topic t inner join 74hu_user u on t.userid=u.id where t.classid="&id&" order by t.id desc"
			Case "good"
				ex_ = hu.url("bbs_topic.asp?id="&id&"&amp;act=new","新帖")&"."&hu.url("bbs_topic.asp?id="&id, "顶帖")&".精华"
				sql = "select t.id,t.title,t.reply,t.hit,u.name from 74hu_topic t inner join 74hu_user u on t.userid=u.id where t.classid="&id&" and (t.type=1 or t.type=12 or t.type=13) order by t.id desc"
		End Select
		classname=nowml(rs("name"))'论坛名称
		Call setVisitPage("<a href='"&http_path&"bbs_topic.asp?id="&id&"&amp;[sid]'>"&getLeft(classname,8)&"</a>")
		theme=nowml(rs("remark"))'论坛备注
		staff=rs("host")'论坛版主
		rs.close
		userid=user_array(0)
		hu.title = classname
		body_ = checkMsg()'信息
		body_ = body_ & "[div=nav]-"&hu.url("?aid=index","首页")&"-"&classname&"[/div]"
		post=showImg("post")&hu.url("bbs_post.asp?id="&id, "发帖")&"."& ex_
		ad4txt=getAD(4,1)
		Set rs = Server.CreateObject("ADODB.Recordset")
		rs.open sql, hu.db, 1, 1
		If Not rs.eof Then
			count = rs.recordcount
			PageSize=numBbsList
			page=getN("page",1)
			if page<=0 then page=1
			pagecount=(count+pagesize-1)\pagesize
			if page>pagecount then page=pagecount
			rs.move(pagesize*(page-1))
			For i=1 To PageSize
				If rs.eof Then Exit For
				tip_=""
				tid=rs("id")
				title=rs("title")
				reply=rs("reply")
				name=rs("name")
				hit=rs("hit")

				imgJing=showImg("jing")
				imgFile=showImg("file")
				ImgImage=showImg("image")
				imgDing=showImg("ding")

				If act<>"good" Then
					Select Case rs("type")
						Case 1
							tip_= imgJing
						Case 2
							tip_= imgFile
						Case 3
							tip_= ImgImage
						Case 12
							tip_= imgJing & imgFile
						Case 13
							tip_= imgJing & ImgImage
					End Select
					If act="" Then
						If rs("pid")=1 Then tip_= imgDing & tip_
					End If
				Else
					tip_= imgJing
				End If
				list=list& "[div=odd]"&tip_&hu.url("bbs_posts.asp?id="&tid&"&amp;p="&page&"&amp;act="&act, (i+(page-1)*PageSize)&"."&nowml(rs("title")))&"[/div]"&_
					"[div=even]"&name&"("&hu.url("bbs_replys.asp?id="&tid,reply)&"/"&hit&")[/div]"

				rs.moveNext
			Next
			list=list& showPage("bbs_topic.asp", "aid:list,act:"&act&",id:"&id, page, pagecount)
			
		Else
			list= "暂时没有帖子"
		End If
		admin= "<br/>"&showImg("light")&hu.url("bbs_board.asp?id="&id,"版务")
		If staff<>0 Then admin=admin& " 版主:"&hu.url("bbs_user.asp?id="&staff,getUserName(staff))
		Dim rndnum
		rndnum=time_r'要避免内容中有{}标签,需将{}转义
		tpl=Replace(tpl,"{","{_74hu_"&rndnum)
		tpl=Replace(tpl,"{_74hu_"&rndnum&"ad4}",ad4txt,1,1)
		tpl=Replace(tpl,"{_74hu_"&rndnum&"post}",post,1,1)
		tpl=Replace(tpl,"{_74hu_"&rndnum&"admin}",admin,1,1)
		tpl=Replace(tpl,"{_74hu_"&rndnum&"list}",list,1,1)
		tpl=Replace(tpl,"{_74hu_"&rndnum&"theme}",theme,1,1)
		body_ = body_ & tpl
	Else
		rupt "论坛页面出错！","没有这个论坛!"
	End If
	rs.close
	Set rs=Nothing
	hu.body = comUbb(body_)
End Sub

%>